/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.nanosl.norg.ent;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Thilina
 */
@Embeddable
public class AttendancePK implements Serializable {
    @Basic(optional = false)
    @Column(name = "time_in")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeIn;
    @Basic(optional = false)
    @Column(name = "employee_id")
    private String employeeId;
    @Basic(optional = false)
    @Column(name = "employee_organization_id")
    private String employeeOrganizationId;

    public AttendancePK() {
    }

    public AttendancePK(Date timeIn, String employeeId, String employeeOrganizationId) {
        this.timeIn = timeIn;
        this.employeeId = employeeId;
        this.employeeOrganizationId = employeeOrganizationId;
    }

    public Date getTimeIn() {
        return timeIn;
    }

    public void setTimeIn(Date timeIn) {
        this.timeIn = timeIn;
    }

    public String getEmployeeId() {
        return employeeId;
    }

    public void setEmployeeId(String employeeId) {
        this.employeeId = employeeId;
    }

    public String getEmployeeOrganizationId() {
        return employeeOrganizationId;
    }

    public void setEmployeeOrganizationId(String employeeOrganizationId) {
        this.employeeOrganizationId = employeeOrganizationId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (timeIn != null ? timeIn.hashCode() : 0);
        hash += (employeeId != null ? employeeId.hashCode() : 0);
        hash += (employeeOrganizationId != null ? employeeOrganizationId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AttendancePK)) {
            return false;
        }
        AttendancePK other = (AttendancePK) object;
        if ((this.timeIn == null && other.timeIn != null) || (this.timeIn != null && !this.timeIn.equals(other.timeIn))) {
            return false;
        }
        if ((this.employeeId == null && other.employeeId != null) || (this.employeeId != null && !this.employeeId.equals(other.employeeId))) {
            return false;
        }
        if ((this.employeeOrganizationId == null && other.employeeOrganizationId != null) || (this.employeeOrganizationId != null && !this.employeeOrganizationId.equals(other.employeeOrganizationId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.nanosl.norg.ent.AttendancePK[ timeIn=" + timeIn + ", employeeId=" + employeeId + ", employeeOrganizationId=" + employeeOrganizationId + " ]";
    }
    
}
